package com.lianqi.emcpframework.design.support;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @program emcp-domain-design
 * @ClassName AbstractEntityDto
 * @description: 抽象dto类
 * @author: sky
 * @create: 2019-06-12 20:06
 */
@Data
public abstract class AbstractEntityDto<T, ID> {

    @ApiModelProperty(value = "数据版本", name = "version")
    private long version;
    @ApiModelProperty(value = "主键", name = "id")
    private ID id;
    @ApiModelProperty(value = "创建时间, MS", name = "createTimeAsMS")
    private Long createTimeAsMS;
    @ApiModelProperty(value = "修改时间, MS", name = "updateTimeAsMS")
    private Long updateTimeAsMS;

    protected AbstractEntityDto(AbstractEntity<T, ID> source) {
        this.setVersion(source.getVersion());
        this.setId(source.getId());
        this.setCreateTimeAsMS(source.getCreateTimeAsMS());
        this.setUpdateTimeAsMS(source.getUpdateTimeAsMS());
    }

    protected AbstractEntityDto() {}
}
